#ifndef JOINTANIMATIONPLAYER_H
#define JOINTANIMATIONPLAYER_H
#include "StompedReality/Asset/JointAnimation.h"
#include "StompedReality/Core.h"
namespace StompedReality
{
namespace animation
{
class DLL_EXPORT JointAnimationPlayer
{
 protected:

  bool _playAsLoop;
  int _startIndex;
  double _startTime;
  double _frameTime;

  // current and next frame idx
  int _currentFrameIDX;
  int _nextFrameIDX;

  // frames
  KeyFrame* _currentFrame;
  KeyFrame* _nextFrame;

  // playing ?
  bool _playing;
  JointAnimation* _animation;

 public:

  JointAnimationPlayer( );
  virtual ~JointAnimationPlayer( );

  // getter setter

 public:

  void setAnimation( JointAnimation* animation );
  void playAsLoop( bool looped );
  double getFrameTime( );
  int getCurrentIndex( );
  int getNextIndex( );
  KeyFrame* getCurrentFrame( );
  KeyFrame* getNextFrame( );
  bool isPlaying( );
  bool shoudlPlayAsLoop( );

  // anim functions

 public:

  void start( );
  void updateFrameTime ( double dt );
  float calculateRotation( );
};

}
}
#endif // JOINTANIMATIONPLAYER_H
